//
//  collateCell.m
//  PaiQuan
//
//  Created by Mac on 16/7/13.
//  Copyright © 2016年 huigu. All rights reserved.
//

#import "collateCell.h"

@implementation collateCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = PQ_COLOR_LightGray;
        [self setUPUI];
        [self setUPCon];
    }
    return self;
}
-(void)setUPUI{
    [self.contentView addSubview:self.backGroundView];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.numLabel];
    [self.contentView addSubview:self.timeLabel];
    [self.contentView addSubview:self.leftBtn];
    [self.contentView addSubview:self.rightBtn];
    
}

-(void)setUPCon{
    
    [self.backGroundView makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.top).offset(RATIO(8));
        make.left.equalTo(self.contentView.left).offset(RATIO(24));
        make.right.equalTo(self.contentView.right).offset(-RATIO(24));
        make.bottom.equalTo(self.contentView.bottom).offset(-RATIO(8));
    }];
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.top).offset(RATIO(30));
        make.left.equalTo(self.left).offset(RATIO(80));
        
    }];
    
    [self.numLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.bottom).offset(RATIO(34));
        make.left.equalTo(self.left).offset(RATIO(80));
    }];
    [self.timeLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.bottom).offset(RATIO(34));
        make.left.equalTo(self.left).offset(RATIO(230));
    }];
    [self.rightBtn makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView.right).offset(-RATIO(40));
        make.width.height.equalTo(RATIO(50));
        
    }];
    [self.leftBtn makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.rightBtn.left).offset(-RATIO(10));
        make.width.height.equalTo(RATIO(50));
        
    }];
    
}
-(UILabel*)nameLabel{
    if (!_nameLabel ) {
        _nameLabel = [[UILabel alloc] init];
                [_nameLabel setTextColor:PQ_COLOR_BLACK];
        [_nameLabel setFont:FONT(15)];
        [_nameLabel setText:@"帕丽斯"];
        
    }
    
    return _nameLabel;
    
}
-(UILabel*)numLabel{
    if (!_numLabel ) {
        _numLabel = [[UILabel alloc] init];
        [_numLabel setText:@"哈哈"];
        [_numLabel setTextColor:PQ_COLOR_SimpleGary];
        [_numLabel setFont:FONT(14)];
        
        
    }
    
    return _numLabel;
    
}
-(UILabel*)timeLabel{
    if (!_timeLabel ) {
        _timeLabel = [[UILabel alloc] init];
        [_timeLabel setText:@"123"];
               [_timeLabel setTextColor:PQ_COLOR_SimpleGary];
        [_timeLabel setFont:FONT(14)];
        
        
    }
    
    return _timeLabel;
    
}
-(UIView*)backGroundView{
    if (!_backGroundView ) {
        
        _backGroundView = [[UIView alloc] init];
        _backGroundView.userInteractionEnabled =NO;
        _backGroundView.backgroundColor = [UIColor whiteColor];
        _backGroundView.layer.cornerRadius = RATIO(10);
        _backGroundView.layer.masksToBounds = YES;
        
    }
    return _backGroundView;
    
    
}
-(UIButton *)leftBtn{
    if (!_leftBtn) {
        _leftBtn = [[UIButton alloc] init];
        _leftBtn.backgroundColor = [UIColor redColor];
        _leftBtn.layer.cornerRadius = RATIO(10);
        _leftBtn.layer.masksToBounds = YES;
    }
    return _leftBtn;
}
-(UIButton *)rightBtn{
    if (!_rightBtn) {
        _rightBtn = [[UIButton alloc] init];
        _rightBtn.backgroundColor = [UIColor redColor];
        _rightBtn.layer.cornerRadius = RATIO(10);
        _rightBtn.layer.masksToBounds = YES;
    }
    return _rightBtn;
}

@end
